using System;
using System.Web.Caching;
using EPiServer.Common.Cache;

namespace EPiAbstractions.Common.Cache
{
    public interface ICacheHandlerFacade
    {
        void InitializeCache();

        Object GetCachedObject(Delegate cacheObjectGetter, Object[] getterArgs, String[] key);

        Object GetCachedObject(Delegate cacheObjectGetter, Object[] getterArgs, TimeSpan? cacheTimeSpan, String[] key);

        Object GetCachedObject(Delegate cacheObjectGetter, Object[] getterArgs, TimeSpan? cacheTimeSpan,
                               NotFoundInCacheAnnouncer notFoundInCacheAnnouncer, String[] key);

        Object GetCachedObject(String[] key);

        Object GetCachedObject(String keyPath);

        void SetCachedObject(ICacheable cacheable);

        void SetCachedObject(Object obj, String[] key);

        void SetCachedObject(Object obj, Int32 seconds, String[] key);

        void SetCachedObject(Object obj, DateTime expiry, String[] key);

        void SetCachedObject(Object obj, TimeSpan span, CacheItemPriority priority, String[] key);

        void SetCachedObject(Object obj, DateTime expiry, CacheItemPriority priority, String[] key);

        void RemoveCachedObject(ICacheable cacheable);

        void RemoveCachedObject(String[] key);

        void RemoveCachedObject(String keyPath);

        void AddDependency(String[] dependsOn, String[] dependent);

        void RemoveDependency(String[] dependsOn, String[] dependent);

        void OnRemoveCache(String key, Object val, CacheItemRemovedReason reason);

        event CacheHandler.RemoveCacheEventHandler RemovedCache;

        String GenerateCacheKey(String[] keyParts);

        String[] ParseCacheKey(String key);
    }
}